﻿<UserControl x:Class="TFS.Kanban.Modules.KanbanBoard.Views.Components.Card"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
    <Border BorderBrush="black" BorderThickness=".0,.0,2,2" CornerRadius="12"
    Height="140" Width="190" Canvas.Top="30" Canvas.Left="55">
        
        <Border BorderBrush="black" BorderThickness="0.5" CornerRadius="12" Padding="10">
            
            <Border.Background>
                <SolidColorBrush Color="{Binding CardColor}"/>
            </Border.Background>
            
            <DockPanel LastChildFill="True">
                       
                <!-- Color Picking -->
                <StackPanel DockPanel.Dock="Bottom" Height="20">
                    <ListView ItemsSource="{Binding PossibleColors}" Background="{Binding CardColor}" BorderThickness="0">
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel 
                                Background="{Binding Path=CardColor, 
                                                     RelativeSource={RelativeSource AncestorType=ListView}}" 
                                Orientation="Horizontal"></StackPanel>
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Button 
                                Background="{Binding}" 
                                Height="20" 
                                Width="20" 
                                BorderBrush="Transparent" 
                                BorderThickness="0" 
                                Command="{Binding Path=DataContext.ChangeColor,   
                                                  RelativeSource={RelativeSource AncestorType=ListView}}" 
                                CommandParameter="{Binding}"/>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </StackPanel>
                
                <!-- Card Details -->
                <Grid>
                    <TextBlock Text="{Binding Name}" />
                </Grid>
                
            </DockPanel>
        </Border>
    </Border>

</UserControl>
